package com.spring.theory.mvc.basic.handlerMethod;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * HandlerWebConfig
 *
 * @author H
 * @version 1.0
 * @date 2024-05-09 16:29
 */
@Configuration
@Slf4j
public class HandlerWebConfig {
    @Controller
    static class HandlerController {

        @ResponseStatus(HttpStatus.OK)
        public void test(@ModelAttribute HandlerUser user) {
            log.info("控制器方法执行HandlerController.test方法...");
        }
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @ToString
    static class HandlerUser {
        private String name;
    }

}
